<template>
    <div>
        <a-modal v-model="show" title="编辑组织" @ok="submit" @cancel="show = false">
            <a-form :label-col="{ span: 5 }" :wrapper-col="{ span: 19 }">
                <a-form-item label="组织名称">
                    <a-input v-model="editOrgData.orgName"  />
                </a-form-item>
            </a-form>
        </a-modal>
    </div>
</template>
<script>
    import { message } from 'ant-design-vue';
    import { editOrg } from "@/services/v2"

    export default {
        props: {
            
        },
        data() {
            return {
                // 是否显示弹框
                show: false,
				editOrgData:[],
            }
        },
        methods: {
            
			//打开弹窗,初始化
            open(data) {
                this.show = true 
				this.editOrgData = data;
            },
			
            //编辑提交
            submit:function() {
                let self = this;
				editOrg(self.editOrgData).then((ref) => {
					if(ref.code != 0){
						return message.warning(ref.msg);
					}
					message.success('编辑成功', 2, function(){
						self.show = false; //关闭编辑组件
						self.$emit('ok', 1);//通知父级
					});
				});
            }
        },
    }
</script>